# Copyright 2022 99Cloud, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# flake8: noqa
# fmt: off

"""first revision

Revision ID: ecb5347c939e
Revises: 
Create Date: 2022-07-06 16:53:03.800611

"""

from __future__ import annotations

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = 'ecb5347c939e'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('country',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('code', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_country_code'), 'country', ['code'], unique=True)
    op.create_index(op.f('ix_country_id'), 'country', ['id'], unique=False)
    op.create_table('rsm',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('ref_pos', sa.JSON(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsm_id'), 'rsm', ['id'], unique=False)
    op.create_table('rsu_config',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('bsm', sa.JSON(), nullable=True),
    sa.Column('rsi', sa.JSON(), nullable=True),
    sa.Column('rsm', sa.JSON(), nullable=True),
    sa.Column('map', sa.JSON(), nullable=True),
    sa.Column('spat', sa.JSON(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_config_id'), 'rsu_config', ['id'], unique=False)
    op.create_index(op.f('ix_rsu_config_name'), 'rsu_config', ['name'], unique=True)
    op.create_table('rsu_log',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('upload_url', sa.String(length=64), nullable=False),
    sa.Column('user_id', sa.String(length=64), nullable=False),
    sa.Column('password', sa.String(length=255), nullable=False),
    sa.Column('transprotocal', sa.Enum('http', 'https', 'ftp', 'sftp', 'other'), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_log_id'), 'rsu_log', ['id'], unique=False)
    op.create_table('rsu_model',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('manufacturer', sa.String(length=64), nullable=False),
    sa.Column('desc', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_model_id'), 'rsu_model', ['id'], unique=False)
    op.create_index(op.f('ix_rsu_model_manufacturer'), 'rsu_model', ['manufacturer'], unique=False)
    op.create_index(op.f('ix_rsu_model_name'), 'rsu_model', ['name'], unique=True)
    op.create_table('rsu_query',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('query_type', sa.Integer(), nullable=False),
    sa.Column('time_type', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_query_id'), 'rsu_query', ['id'], unique=False)
    op.create_table('rsu_tmp',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('rsu_id', sa.String(length=64), nullable=False),
    sa.Column('rsu_esn', sa.String(length=64), nullable=False),
    sa.Column('rsu_name', sa.String(length=64), nullable=False),
    sa.Column('rsu_status', sa.String(length=4), nullable=False),
    sa.Column('version', sa.String(length=64), nullable=False),
    sa.Column('location', sa.JSON(), nullable=False),
    sa.Column('config', sa.JSON(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_tmp_id'), 'rsu_tmp', ['id'], unique=False)
    op.create_index(op.f('ix_rsu_tmp_rsu_esn'), 'rsu_tmp', ['rsu_esn'], unique=True)
    op.create_index(op.f('ix_rsu_tmp_rsu_name'), 'rsu_tmp', ['rsu_name'], unique=False)
    op.create_table('user',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('username', sa.String(length=255), nullable=False),
    sa.Column('hashed_password', sa.String(length=4096), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.Column('is_superuser', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_id'), 'user', ['id'], unique=False)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('province',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('country_code', sa.String(length=64), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['country_code'], ['country.code'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_province_code'), 'province', ['code'], unique=True)
    op.create_index(op.f('ix_province_id'), 'province', ['id'], unique=False)
    op.create_table('rsm_participants',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('rsm_id', sa.Integer(), nullable=True),
    sa.Column('ptc_type', sa.Enum('unknown', 'motor', 'non_motor', 'pedestrian', 'rsu', name='ptctype'), nullable=False),
    sa.Column('ptc_id', sa.Integer(), nullable=False),
    sa.Column('source', sa.Integer(), nullable=False),
    sa.Column('sec_mark', sa.Integer(), nullable=True),
    sa.Column('pos', sa.JSON(), nullable=False),
    sa.Column('accuracy', sa.String(length=255), nullable=True),
    sa.Column('speed', sa.Integer(), nullable=True),
    sa.Column('heading', sa.Integer(), nullable=True),
    sa.Column('size', sa.JSON(), nullable=True),
    sa.ForeignKeyConstraint(['rsm_id'], ['rsm.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsm_participants_id'), 'rsm_participants', ['id'], unique=False)
    op.create_table('city',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('province_code', sa.String(length=64), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['province_code'], ['province.code'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_city_code'), 'city', ['code'], unique=True)
    op.create_index(op.f('ix_city_id'), 'city', ['id'], unique=False)
    op.create_table('area',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('city_code', sa.String(length=64), nullable=True),
    sa.Column('code', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['city_code'], ['city.code'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_area_code'), 'area', ['code'], unique=True)
    op.create_index(op.f('ix_area_id'), 'area', ['id'], unique=False)
    op.create_table('map',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('address', sa.String(length=255), nullable=False, comment='specific location'),
    sa.Column('area_code', sa.String(length=64), nullable=True),
    sa.Column('desc', sa.String(length=255), nullable=False),
    sa.Column('lat', sa.Float(), nullable=False),
    sa.Column('lng', sa.Float(), nullable=False),
    sa.Column('data', sa.JSON(), nullable=True),
    sa.ForeignKeyConstraint(['area_code'], ['area.code'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_map_id'), 'map', ['id'], unique=False)
    op.create_index(op.f('ix_map_name'), 'map', ['name'], unique=True)
    op.create_table('rsu',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('rsu_id', sa.String(length=64), nullable=False),
    sa.Column('rsu_esn', sa.String(length=64), nullable=False, comment='serial number'),
    sa.Column('rsu_ip', sa.String(length=64), nullable=False),
    sa.Column('rsu_name', sa.String(length=64), nullable=False),
    sa.Column('version', sa.String(length=64), nullable=False),
    sa.Column('rsu_status', sa.String(length=4), nullable=False),
    sa.Column('location', sa.JSON(), nullable=False),
    sa.Column('config', sa.JSON(), nullable=False),
    sa.Column('online_status', sa.Boolean(), nullable=False),
    sa.Column('rsu_model_id', sa.Integer(), nullable=True),
    sa.Column('area_code', sa.String(length=64), nullable=True),
    sa.Column('address', sa.String(length=255), nullable=False, comment='Installation specific location'),
    sa.Column('desc', sa.String(length=255), nullable=True),
    sa.Column('log_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['area_code'], ['area.code'], ),
    sa.ForeignKeyConstraint(['log_id'], ['rsu_log.id'], ),
    sa.ForeignKeyConstraint(['rsu_model_id'], ['rsu_model.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_id'), 'rsu', ['id'], unique=False)
    op.create_index(op.f('ix_rsu_online_status'), 'rsu', ['online_status'], unique=False)
    op.create_index(op.f('ix_rsu_rsu_esn'), 'rsu', ['rsu_esn'], unique=True)
    op.create_index(op.f('ix_rsu_rsu_name'), 'rsu', ['rsu_name'], unique=False)
    op.create_index(op.f('ix_rsu_rsu_status'), 'rsu', ['rsu_status'], unique=False)
    op.create_table('camera',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('sn', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('stream_url', sa.String(length=255), nullable=False),
    sa.Column('lng', sa.Float(), nullable=False),
    sa.Column('lat', sa.Float(), nullable=False),
    sa.Column('elevation', sa.Float(), nullable=False),
    sa.Column('towards', sa.Float(), nullable=False),
    sa.Column('status', sa.Boolean(), nullable=False),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.Column('desc', sa.String(length=255), nullable=False),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_camera_id'), 'camera', ['id'], unique=False)
    op.create_index(op.f('ix_camera_name'), 'camera', ['name'], unique=False)
    op.create_index(op.f('ix_camera_sn'), 'camera', ['sn'], unique=True)
    op.create_table('map_rsu',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('map_id', sa.Integer(), nullable=True),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.Column('status', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['map_id'], ['map.id'], ),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_map_rsu_id'), 'map_rsu', ['id'], unique=False)
    op.create_table('mng',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.Column('heartbeat_rate', sa.Integer(), nullable=True),
    sa.Column('running_info_rate', sa.Integer(), nullable=True),
    sa.Column('log_rate', sa.Integer(), nullable=True),
    sa.Column('log_level', sa.Enum('DEBUG', 'INFO', 'ERROR', 'WARN', 'NOLog'), nullable=True),
    sa.Column('reboot', sa.Enum('not_reboot', 'reboot', name='reboot'), nullable=True),
    sa.Column('address_change', sa.JSON(), nullable=True),
    sa.Column('extend_config', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_mng_id'), 'mng', ['id'], unique=False)
    op.create_table('radar',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('sn', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.Column('radar_ip', sa.String(length=15), nullable=False),
    sa.Column('lng', sa.Float(), nullable=False),
    sa.Column('lat', sa.Float(), nullable=False),
    sa.Column('elevation', sa.Float(), nullable=False),
    sa.Column('towards', sa.Float(), nullable=False),
    sa.Column('status', sa.Boolean(), nullable=False),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.Column('desc', sa.String(length=255), nullable=False),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_radar_id'), 'radar', ['id'], unique=False)
    op.create_index(op.f('ix_radar_name'), 'radar', ['name'], unique=False)
    op.create_index(op.f('ix_radar_sn'), 'radar', ['sn'], unique=True)
    op.create_table('rsi_event',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.Column('area_code', sa.String(length=64), nullable=True),
    sa.Column('address', sa.String(length=64), nullable=False),
    sa.Column('alert_id', sa.String(length=64), nullable=True),
    sa.Column('duration', sa.Integer(), nullable=True),
    sa.Column('event_status', sa.Boolean(), nullable=True),
    sa.Column('timestamp', sa.String(length=64), nullable=True, comment='yyyy-MM-ddT HH:mm:ss.SSS Z'),
    sa.Column('event_class', sa.Enum('AbnormalTraffic', 'AdverseWeather', 'AbnormalVehicle', 'TrafficSign', name='eventclass'), nullable=True),
    sa.Column('event_type', sa.Integer(), nullable=True),
    sa.Column('event_source', sa.Enum('unknown', 'police', 'government', 'meteorological', 'internet', 'detection', name='eventsource'), nullable=True),
    sa.Column('event_confidence', sa.Float(), nullable=True),
    sa.Column('event_position', sa.JSON(), nullable=True),
    sa.Column('event_radius', sa.Float(), nullable=True),
    sa.Column('event_description', sa.String(length=255), nullable=True),
    sa.Column('event_priority', sa.Integer(), nullable=True),
    sa.Column('reference_paths', sa.JSON(), nullable=True),
    sa.ForeignKeyConstraint(['area_code'], ['area.code'], ),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsi_event_address'), 'rsi_event', ['address'], unique=False)
    op.create_index(op.f('ix_rsi_event_id'), 'rsi_event', ['id'], unique=False)
    op.create_table('rsu_config_rsu',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('rsu_config_id', sa.Integer(), nullable=True),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.Column('status', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['rsu_config_id'], ['rsu_config.id'], ),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_config_rsu_id'), 'rsu_config_rsu', ['id'], unique=False)
    op.create_table('rsu_query_result',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('query_id', sa.Integer(), nullable=True),
    sa.Column('rsu_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['query_id'], ['rsu_query.id'], ),
    sa.ForeignKeyConstraint(['rsu_id'], ['rsu.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_query_result_id'), 'rsu_query_result', ['id'], unique=False)
    op.create_table('rsu_query_result_data',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('result_id', sa.Integer(), nullable=True),
    sa.Column('data', sa.JSON(), nullable=True),
    sa.ForeignKeyConstraint(['result_id'], ['rsu_query_result.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rsu_query_result_data_id'), 'rsu_query_result_data', ['id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_rsu_query_result_data_id'), table_name='rsu_query_result_data')
    op.drop_table('rsu_query_result_data')
    op.drop_index(op.f('ix_rsu_query_result_id'), table_name='rsu_query_result')
    op.drop_table('rsu_query_result')
    op.drop_index(op.f('ix_rsu_config_rsu_id'), table_name='rsu_config_rsu')
    op.drop_table('rsu_config_rsu')
    op.drop_index(op.f('ix_rsi_event_id'), table_name='rsi_event')
    op.drop_index(op.f('ix_rsi_event_address'), table_name='rsi_event')
    op.drop_table('rsi_event')
    op.drop_index(op.f('ix_radar_sn'), table_name='radar')
    op.drop_index(op.f('ix_radar_name'), table_name='radar')
    op.drop_index(op.f('ix_radar_id'), table_name='radar')
    op.drop_table('radar')
    op.drop_index(op.f('ix_mng_id'), table_name='mng')
    op.drop_table('mng')
    op.drop_index(op.f('ix_map_rsu_id'), table_name='map_rsu')
    op.drop_table('map_rsu')
    op.drop_index(op.f('ix_camera_sn'), table_name='camera')
    op.drop_index(op.f('ix_camera_name'), table_name='camera')
    op.drop_index(op.f('ix_camera_id'), table_name='camera')
    op.drop_table('camera')
    op.drop_index(op.f('ix_rsu_rsu_status'), table_name='rsu')
    op.drop_index(op.f('ix_rsu_rsu_name'), table_name='rsu')
    op.drop_index(op.f('ix_rsu_rsu_esn'), table_name='rsu')
    op.drop_index(op.f('ix_rsu_online_status'), table_name='rsu')
    op.drop_index(op.f('ix_rsu_id'), table_name='rsu')
    op.drop_table('rsu')
    op.drop_index(op.f('ix_map_name'), table_name='map')
    op.drop_index(op.f('ix_map_id'), table_name='map')
    op.drop_table('map')
    op.drop_index(op.f('ix_area_id'), table_name='area')
    op.drop_index(op.f('ix_area_code'), table_name='area')
    op.drop_table('area')
    op.drop_index(op.f('ix_city_id'), table_name='city')
    op.drop_index(op.f('ix_city_code'), table_name='city')
    op.drop_table('city')
    op.drop_index(op.f('ix_rsm_participants_id'), table_name='rsm_participants')
    op.drop_table('rsm_participants')
    op.drop_index(op.f('ix_province_id'), table_name='province')
    op.drop_index(op.f('ix_province_code'), table_name='province')
    op.drop_table('province')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_id'), table_name='user')
    op.drop_table('user')
    op.drop_index(op.f('ix_rsu_tmp_rsu_name'), table_name='rsu_tmp')
    op.drop_index(op.f('ix_rsu_tmp_rsu_esn'), table_name='rsu_tmp')
    op.drop_index(op.f('ix_rsu_tmp_id'), table_name='rsu_tmp')
    op.drop_table('rsu_tmp')
    op.drop_index(op.f('ix_rsu_query_id'), table_name='rsu_query')
    op.drop_table('rsu_query')
    op.drop_index(op.f('ix_rsu_model_name'), table_name='rsu_model')
    op.drop_index(op.f('ix_rsu_model_manufacturer'), table_name='rsu_model')
    op.drop_index(op.f('ix_rsu_model_id'), table_name='rsu_model')
    op.drop_table('rsu_model')
    op.drop_index(op.f('ix_rsu_log_id'), table_name='rsu_log')
    op.drop_table('rsu_log')
    op.drop_index(op.f('ix_rsu_config_name'), table_name='rsu_config')
    op.drop_index(op.f('ix_rsu_config_id'), table_name='rsu_config')
    op.drop_table('rsu_config')
    op.drop_index(op.f('ix_rsm_id'), table_name='rsm')
    op.drop_table('rsm')
    op.drop_index(op.f('ix_country_id'), table_name='country')
    op.drop_index(op.f('ix_country_code'), table_name='country')
    op.drop_table('country')
    # ### end Alembic commands ###
